﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ivony.Data;

namespace XCommunity.Data
{
  public class AccountStaticsDataProvider
  {

    public readonly static SqlDbUtility DbUtility = new SqlDbUtility( @"Data Source=(local);Initial Catalog=XCommunity;Integrated Security=True" );

    public int GetDocuments( string username )
    {
      return (int) DbUtility.ExecuteScalar( "SELECT COUNT(ID) FROM Documents WHERE Author = {0}", username );
    }

    public int GetTopics( string username )
    {
      return (int) DbUtility.ExecuteScalar( "SELECT COUNT(ID) FROM Topics WHERE Launcher = {0}", username );
    }

  }
}
